	var imgarr = new Array('1.jpg','2.jpg','3.jpg');
	var k = 0;
	var color = '#fff';
	var spcolor = '#f00';
	function change(){
		
		document.getElementById('img').src = 'images/'+imgarr[k];
		chNum();
	}
	function chNum(){
		var span = document.getElementById('num').getElementsByTagName('span');
		var len = span.length;
		for(var i = 0;i<len;i++){
		span[i].style.backgroundColor = color;
		}
		span[k].style.backgroundColor = spcolor;	
	}
	
	function run(){
		k++;
		(k == imgarr.length) && (k = 0);
		change();
	}
	var timer = window.setInterval('run()',2000);
	function stop(){
		window.clearInterval(timer);
	}
	function started(){
		timer = window.setInterval('run()',2000);
	}

	function stoped(num){
		window.clearInterval(timer);
		k = num-1;
		change();
	}